#include<iostream>
#include<cstring>
using namespace std;
const int N=1e5;//1e5
int a[N];
int n;
int res=0x3f,cnt=0;
bool st[N],dead[N],eat[N];
void dfs(int x,int c)
{
    if(x==n)
    {
        cnt=n;
        for(int i=1;i<=n;i++)
            if(dead[i]==1)
                cnt--;
        return;
    }
    for(int i=1;i<=n;i++)
    {
        if(x!=i&&st[i]==0)
        {
            st[i]=1;
            if(eat[x]==0&&a[x]<=a[i]){
               dead[i]=1;
               eat[x]=1;
            }
            dfs(i,c+1);
            st[i]=0;
            dead[i]=0;
            eat[x]=0;
        }
        if(c==1&&cnt!=0)
        {
//            cout << cnt << endl;
            res=min(res,cnt);
        }
    }
    return;
}
int main()
{
//Remember to guan bi zhu shi
//duel

    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    dfs(1,1);
    printf("%d",res);
    return 0;
}
